<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录页面</title>
    <style>
        body {
            background:  no-repeat center center fixed;
            background-size: cover;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .login-module {
            background: rgba(255, 255, 255, 0.8);
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            width: 400px;
            margin: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .login-module h1 {
            color: #007bff;
            font-size: 45px;
            margin-bottom: 20px;
        }
        .login-module input[type="text"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 10px;
            box-sizing: border-box;
        }
        .login-module input[type="password"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 10px;
            box-sizing: border-box;
        }
        .login-module button {
            width: 100%;
            padding: 10px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            margin-bottom: 10px;
        }
        .login-module button:hover {
            background-color: #0056b3;
        }
        .login-module a {
            color: #007bff;
            text-decoration: none;
            transition: color 0.3s;
            margin: 5px 0;
        }
        .login-module a:hover {
            color: #0056b3;
        }
    </style>
</head>
<body>
<div class="login-module">
    <input type="text" id="movieName" placeholder="请输入名称">
    <input type="text" id="movieType" placeholder="请输入类型">
    <input type="text" id="movieLength" placeholder="请输入时长">
    <input type="text" id="movieTime" placeholder="请输入放映时间">
    <input type="text" id="moviePrice" placeholder="请输入价格">
    <input type="text" id="movieArea" placeholder="请输入区域">
    <input type="text" id="releaseDate" placeholder="请输入上映时间">
    <input type="text" id="movieBoxOffice" placeholder="请输入总票房">
    <input type="text" id="movieIntroduction" placeholder="请输入简介">
    <button type="submit" onclick="AddMovie()">添加</button>
</div>
<script>
    function AddMovie() {
        const movieName = document.getElementById("movieName").value;
        const movieType = document.getElementById("movieType").value;
        const movieLength = document.getElementById("movieLength").value;
        const movieTime = document.getElementById("movieTime").value;
        const moviePrice = document.getElementById("moviePrice").value;
        const movieArea = document.getElementById("movieArea").value;
        const releaseDate = document.getElementById("releaseDate").value;
        const movieBoxOffice = document.getElementById("movieBoxOffice").value;
        const movieIntroduction = document.getElementById("movieIntroduction").value;
        if (!movieName) {
            alert("请输入电影信息");
            return;
        }
        fetch('/movie/addMovie', {
            method: "POST",
            headers: {
                "Content-Type": "application/json;charset=UTF-8"
            },
            body: JSON.stringify({
                movieName: movieName,
                movieType: movieType,
                movieLength: movieLength,
                movieTime: movieTime,
                moviePrice: moviePrice,
                movieArea: movieArea,
                releaseDate: releaseDate,
                movieBoxOffice: movieBoxOffice,
                movieIntroduction: movieIntroduction
            })
        }).then(res => res.text())
            .then(res => {
            if (res) {
               alert("添加成功");
            }
        });
    }
</script>
</body>
</html>
